<?php

namespace CMBUBank\UBank\Request\TransManager;

use CMBUBank\UBank\Request\UBankBaseRequest;
use CMBUBank\UBank\Response\TransManager\TransManagerCreateSubunitResponse;

class TransManagerCreateSubunitRequest extends UBankBaseRequest
{
    protected $code = 'NTDMAADD';

    protected $response = TransManagerCreateSubunitResponse::class;

    protected $logTip = '新增记账子单元';

    private $busMode;

    private $backNo;

    private $account;

    /**
     * 额度控制
     * @var  $overControl
     */
    private $overControl;

    /**
     * 退票处理方式
     * @var  $backType
     */
    private $backType;

    /**
     * 余额非零时是否可关闭
     * @var  $closeType
     */
    private $closeType;

    private $subName;

    private $subCode;

    public function generate(): array
    {
        return [
            'ntbusmody' => [
                'busmod' => $this->busMode,
            ],
            //'ntdmaaddx' => [
            //    'bbknbr' => $this->backNo,
            //    'inbacc' => $this->account,
            //    'dyanbr' => $this->subCode,
            //    'dyanam' => $this->subName,
            //    'eftdat' => date('Ymd'),
            //    'bcktyp' => $this->backType,
            //    'yurref' => $this->newReqCode(),
            //    'ovrctl' => $this->overControl,
            //    'clstyp' => $this->closeType
            //],
            'ntdmaaddx' => [
                'accnbr' => $this->account,
                'dmanbr' => $this->subCode,
                'dmanam' => $this->subName,
                'bcktyp' => $this->backType,
                'ovrctl' => $this->overControl,
                'clstyp' => $this->closeType,
                'yurref' => $this->newReqCode(),
            ]
        ];
    }

    public function setBusMode($busMode): void
    {
        $this->busMode = $busMode;
    }

    public function setSubCode($subCode): void
    {
        $this->subCode = $subCode;
    }

    public function setSubName($subName): void
    {
        $this->subName = $subName;
    }

    public function setBackNo($backNo): void
    {
        $this->backNo = $backNo;
    }

    public function setOverControl($overControl): void
    {
        $this->overControl = $overControl;
    }

    public function setCloseType($closeType): void
    {
        $this->closeType = $closeType;
    }

    public function setBackType($backType): void
    {
        $this->backType = $backType;
    }

    public function setAccount($account): void
    {
        $this->account = $account;
    }
}